MVVM
Table of Contents
Model-View-ViewModel (MVVM) is a UI architectural pattern designed to separate business data logic, presentation state and UI rendering into different layers. This separation makes code less coupled, easier to test and more scalable.
1. Model Layer
The model layer represents
- business logic
- domain data
- repositories
- networking/DB logic
and should have no knowledge about UI.
2. View Layer
The view layer is the UI layer, which is responsible for rendering state, forwarding user interactions, and should have no knowledge about data logic.
3. Viewmodel Layer
The viewmodel layer is indeed the bridge between models and views. It prepares data for display, manages UI state, handles user actions and coordinates async operations. It transforms raw domain data into UI-friendly state.